<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="/WEB-INF/tld/c.tld"  %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
SimpleDateFormat sf = new SimpleDateFormat("yyyy");
String cur_year=sf.format(new Date());
%>
<!DOCTYPE html>
<html>
<head>
<title>春之翼</title>
<meta charset="utf-8">
<style type="text/css">
	.navbar-header{
		background-color: #0055AA;
		height: 60px;
		position: absolute;
		top: 0px;
		width: 100%;
		color: #ffffff;
		padding:5px 0px 0px 30px
	}
	#footer{
		margin-top:20px;font-size:12px;
		text-align: center;width: 100%;color: #808080;
	}
	.navbar-head{
		color: #ffffff;
		border-left: solid 1px #ffffff;
		padding-left:10px;
	}
	.navbar-brand{
		margin-left:100px;
	}
	@media screen and (max-width: 450px) {
		.navbar-brand{
			margin-left:5px;
		}
	}
</style>
<script type="text/javascript">
	if(top!=this){
		top.location.href="<%=path%>/login.jsp";
	}
</script>
</head>
<body>

	<!-- header -->
	<div class="navbar-header">		
        <img class="navbar-logo" src="css/img/logo.png" alt=""  height="50" align="middle">        
        <span class="navbar-head ng-binding">综合管理平台</span>
    </div>
	<!-- main -->
	<div class="container ng-scope" ng-view="" style="margin-top: 120px;">
		<div class="container login-container well ng-scope" style="width: 380px;" >
			<div id="msg" style="width: 100%;"></div>
			<form name="f" class="form-signin" action='<c:url value="${path}/j_spring_security_check"/>' method="post">
				<div class="form-group">
					<label for="j_username">登录名：${param.j_username }</label> 
					<input type="text" class="form-control ng-dirty ng-valid ng-valid-required" id="j_username" value="${param.j_username }" placeholder="登录名" name="j_username" style="cursor: auto;">
				</div>
				<div class="form-group">
					<label for="j_password">密码：</label>
					<input type="password" class="form-control ng-dirty ng-valid ng-valid-required" id="j_password" placeholder="密码" name="j_password" onfocus="this.type='password'" style="cursor: auto;">
				</div>
				<!-- ngIf: login.showCheckcode -->
				<div class="form-group">
					<button type="button" id="btnLogin" class="btn btn-primary" data-loading-text="正在登录...">登录</button>
					<button type="button" id="btnGetPwd" class="btn btn-link">忘记密码</button>
				</div>
			</form>
		</div>
	</div>
	<div id="footer">
  		春之翼：Framework © <%=cur_year %> 
	</div>
	<link  href="<%=path %>/js/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
	<script type="text/javascript" src="<%=path %>/js/jquery.min.js"></script>
	<script  src="<%=path %>/js/bootstrap/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="js/jquery.cookie.js"></script>
	<script type="text/javascript" src="js/fwTool.js"></script>
	<script type="text/javascript">
		$(function (){
			var err="${SPRING_SECURITY_LAST_EXCEPTION.message }";
			if(err!=''){
			   	$.fwAlert("msg",err)
			}			
			var uname= $.cookie("j_username");
			if(uname!=undefined)
			$("#j_username").val(uname)
			$('#btnLogin').on('click', function () {
			    var uname=$("#j_username").val();
			    if($.trim(uname).length==0){
			    	$("#j_username").focus();
			    	$.fwAlert("msg","登录名不能为空")
			    	return;
			    }
			    var pwd=$("#j_password").val();
			    if($.trim(pwd).length==0){
			    	$("#j_password").focus();
			    	$.fwAlert("msg","密码不能为空")
			    	return;
			    }
			    var $btn = $(this).button('loading')
			    $.cookie("j_username", uname, {expires:7});			    
				document.f.submit();    
			})
			$("#btnGetPwd").click(function (){
				$.fwAlert("msg","暂未开通")
			});
			$(document).keyup(function(event){
			  if(event.keyCode ==13){
			    $("#btnLogin").trigger("click");
			  }
			});
		})
	</script>
</body>
</html>
